//
//  LFFamousTableViewCell.m
//  QingDaoCommunity
//
//  Created by 李学林 on 15/11/25.
//  Copyright © 2015年 teteTechnology. All rights reserved.
//

#import "LFFamousTableViewCell.h"
#import "LFFamousCollectionViewCell.h"

@interface LFFamousTableViewCell()<UICollectionViewDataSource,UICollectionViewDelegate>
@property (weak, nonatomic) IBOutlet UICollectionView *famousCollectionView;

@end


@implementation LFFamousTableViewCell

- (void)awakeFromNib {
    // Initialization code
    
    [self.famousCollectionView registerNib:[UINib nibWithNibName:@"LFFamousCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:@"LFFamousCollectionViewCell"];
    
    self.famousCollectionView.delegate =self;
    self.famousCollectionView.dataSource =self;
    
    
    self.famousCollectionView.layer.borderWidth = 0.5;
    self.famousCollectionView.layer.borderColor = [UIColor lightGrayColor].CGColor;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setFamousList:(LFFamousList *)famousList{

    _famousList = famousList;
    
    [self.famousCollectionView reloadData];


}
#pragma mark----UICollectionViewDataSource
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
    return 1;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    
    return self.famousList.list.count;

}


- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString *UICollectionViewCellID = @"LFFamousCollectionViewCell";
    
    LFFamousCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:UICollectionViewCellID forIndexPath:indexPath];
    
    cell.famous = self.famousList.list[indexPath.item];
    
    
    return cell;
    
}

@end
